<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="demo">
        <div class="box">
            <div class="erweima">x</div>
        </div>
    </div>
    <ul>
        <li>123</li>
        <li>123</li>
        <li>123</li>
        <li>123</li>
        <li>123</li>
    </ul>
    <script>
        // var box = document.querySelector(".box");
        // var erweima = box.querySelector(".erweima");
        // var div = document.querySelector("div");
        // console.log(box);
        // console.log(erweima);
        // console.log(div.getAttribute("class"));
        // var erweima = document.querySelector(".erweima");
        // var box = erweima.parentNode;
        // console.log(erweima.parentNode);
        // console.log(box.parentNode);


        var ul = document.querySelector("ul");
        console.log(ul.childNodes);
        //类型
        console.log(ul.childNodes[0].nodeType);
        for (var i = 0; i < ul.childNodes.length; i++) {
            if (ul.childNodes[i].nodeType == 1) {
                console.log(ul.childNodes[i]);
            }
        }
        console.log(ul.children);
    </script>
</body>

</html>